﻿#include "DeviceStatusItem.h"
#include <QMap>
#include <QVariant>

DeviceStatusItem::DeviceStatusItem(QString name, QString address, bool isConnected)
{
    _name=name;
    _address=address;
    _isConnected=isConnected;
}

QString DeviceStatusItem::Name()
{
    return _name;
}

QString DeviceStatusItem::Address()
{
    return _address;
}

bool DeviceStatusItem::IsConnected()
{
    return _isConnected;
}

void DeviceStatusItem::SetError(QString error)
{
    _error=error;
}

QString DeviceStatusItem::Error()
{
    return _error;
}

QStringList DeviceStatusItem::GetHeaders()
{
    QStringList ret;
    ret<<"设备名"<<"设备地址"<<"连接状态"<<"报警";
    return ret;
}

QMap<QString, QVariant> DeviceStatusItem::GetMap()
{
    QMap<QString,QVariant> ret={
        {"设备名",_name},
        {"设备地址",_address},
        {"连接状态",_isConnected},
        {"报警",_error}
    };
    return ret;
}
